<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/mayioa/css/mayioa-ui.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/datapicker/datepicker3.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/layui/css/layui.css}" rel="stylesheet"/>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-repair-edit" th:object="${repairInfo}">
			<div class="form-group">
				<label class="col-sm-3 control-label ">外包编号：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text"  readonly="true" name="id" readonly="true" th:field="*{id}"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">华为工号：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text"  readonly="true" name="wbCode"  id="hwCode" th:field="*{hwCode}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">员工姓名：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text"  readonly="true" name="name" id="name" th:field="*{name}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">月份：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text"  readonly="true" name="month" id="month" th:field="*{month}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">打卡日期：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text"  readonly="true" name="isoftPm" id="checkDate" th:field="*{checkDate}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">打卡时间：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text"  readonly="true" name="signinTime" id="checkTime" th:field="*{checkTime}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">前20天平均工时：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text"  readonly="true" name="avgFirstHalfMonthHours" id="avgFirstHalfMonthHours" th:field="*{avgFirstHalfMonthHours}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">后10天平均工时：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text"  readonly="true" name="avgLastHalfMonthHours" id="avgLastHalfMonthHours" th:field="*{avgLastHalfMonthHours}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="remark" id="remark" th:field="*{remark}">
				</div>
			</div>
		</form>
	</div>
	<div th:include="include::footer"></div>
	<script th:src="@{/ajax/libs/select/select2.js}"></script>
	<script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
	<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
	<script th:src="@{/ajax/libs//datapicker/bootstrap-datepicker.js}"></script>
	<script th:src="@{/ajax/libs/beautifyhtml/beautifyhtml.js}"></script>
	<script th:src="@{/ajax/libs/layui/lay/modules/upload.js}"></script>

	<script>
        $("#form-repair-edit").validate({
        	rules:{
        		remark:{
        			required:true
        		}
        	},
        	messages: {
        		"remark": {
                    remote: "备注不能为空"
                }
            },
        	submitHandler:function(form){
        		submitHandler();
        	}
        });
        
        function submitHandler() {
	        if ($.validate.form()) {
	        	edit();
	        }
	    }


        function edit() {
        	var id = $("input[name='id']").val();
        	var hwCode = $("input[name='hwCode']").val();
        	var name = $("input[name='name']").val();
        	var month = $("input[name='month']").val();
        	var signinDate = $("input[name='signinDate']").val();
        	var signinTime = $("input[name='signinTime']").val();
        	var avgFirstHalfMonthHours = $("input[name='avgFirstHalfMonthHours']").val();
			var avgLastHalfMonthHours = $("input[name='avgLastHalfMonthHours']").val();
			var remark = $("input[name='remark']").val();

        	$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "worktime/data/edit",
        		data : {
        			"id": id,
        			"hwCode": hwCode,
        			"name": name,
        			"month": month,
        			"signinDate": signinDate,
        			"signinTime": signinTime,
        			"avgFirstHalfMonthHours": avgFirstHalfMonthHours,
        			"avgLastHalfMonthHours": avgLastHalfMonthHours,
        			"remark": remark
        		},
        		async : false,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
        }


    </script>
</body>
</html>
